package com.ymy.thinking.in.spring.dependency.lookup;

import org.springframework.beans.BeanInstantiationException;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * {@link BeanInstantiationException} 示例
 *
 * @author Ringo
 * @date 2021/9/10 14:24
 */
public class BeanInstantiationExceptionDemo {

    public static void main(String[] args) {
        // 创建 IoC 容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        // 注册 BeanDefinition. Bean Class 是一个 CharSequence 接口.
        BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(CharSequence.class);
        applicationContext.registerBeanDefinition("charSequence", builder.getBeanDefinition());

        applicationContext.refresh();


        applicationContext.close();
    }

}
